library(tidyverse)
library(DeclareDesign)
library(rdss)

set.seed(42)

sims <- 2000
bootstrap_sims <- 2000

observed_estimate <-
  lm_robust(
    marked_register_2014 ~ treat + ward,
    weights = weights,
    clusters = street,
    data = foos_etal
  ) 

source("code/declarations/declaration_9.7.R")

p.value <-
  declare_diagnosands(
    p.value = mean(abs(estimate) >= abs(observed_estimate$coefficients[2]))
  )

diagnosis_9.7 <-
  diagnose_design(
    declaration_9.7,
    diagnosands = p.value,
    sims = sims,
    bootstrap_sims = bootstrap_sims
  )

write_rds(diagnosis_9.7, file = "diagnosis_objects/diagnosis_9.7.rds")

